package top.korori.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.korori.sv.entity.vo.*;
import top.korori.sv.service.SvCountService;
import top.korori.common.model.Result;

import java.util.List;

@Api(tags = "数据统计")
@RestController
@RequestMapping("video/count")
public class SvCountController {

    @Autowired
    private SvCountService svCountService;

    @ApiOperation("平台数量统计")
    @GetMapping("/number")
    public Result<SvNumberVo> number(){
        SvNumberVo svNumberVo = svCountService.numberCount();
        return Result.ok(svNumberVo);
    }

    @ApiOperation("日浏览量")
    @GetMapping("/dayBrowse")
    public Result<SvDayBrowseVo> dayBrowse(){
        SvDayBrowseVo svDayBrowseVo = svCountService.dayBrowse();
        return Result.ok(svDayBrowseVo);
    }

    @ApiOperation("性别占比")
    @GetMapping("/sexRatio")
    public Result<List<SvSexRatioVo>> sexRatio(){
        List<SvSexRatioVo> sexRatio = svCountService.sexRatio();
        return Result.ok(sexRatio);
    }

    @ApiOperation("各省人数")
    @GetMapping("/provinceUserNum")
    public Result<List<SvProvinceUserNumVo>> provinceUserNum(){
        List<SvProvinceUserNumVo> svProvinceUserNumVo = svCountService.provinceUserNum();
        return Result.ok(svProvinceUserNumVo);
    }

    @ApiOperation("用户排行")
    @GetMapping("/userRanking")
    public Result<List<SysSvUserVo>> userRanking(){
        List<SysSvUserVo> svUserVos =  svCountService.userRanking();
        return Result.ok(svUserVos);
    }



}

















